set objTextFile = g_objFileSystem.OpenTextFile( strLoadFromCfgFile, 1 )
strCfgFileArguments = objTextFile.ReadLine
objTextFile.Close
strCfgFileArguments = Trim( strCfgFileArguments )
if strCfgFileArguments = "" then
OutputInfo "Configuration file " & strLoadFromCfgFile & " is empty"
ParseParameters = false
exit function
end if
colStrConfigArgs = Split( strCfgFileArguments )
if ParseParameters( colStrConfigArgs ) = false then
ParseParameters = false
exit function
end if
end if
next
' OutputInfo "Args = " & strArguments
if UBound(args) = 0 then
' If it has only has one parameter, check the content of this parameter.
select case LCase( args(0) )
case "-devices":
' List all audio and video devices.
ListDevices()
ParseParameters = false
exit function
case "-a_codecs":
' List all audio codecs.
ListAudioCodecs()
ParseParameters = false
exit function
case "-a_formats"
' List audio formats
ListAudioFormats()
ParseParameters = false
exit function
case "-v_codecs":
' List all video codecs.
ListVideoCodecs()
ParseParameters = false
exit function
case "-help":
' Show help information.
ShowHelp()
ParseParameters = false
exit function
case "-?":
' Show help information.
ShowHelp()
ParseParameters = false
exit function
case "-all?":
' Show help information.
ShowHelp()
ParseParameters = false
exit function
case "/?":
' Show help information.
ShowHelp()
ParseParameters = false
exit function
case "-help?"
' Being up the encoder util chm
ShowHelpChm()
ParseParameters = false
exit function
end select
end if
if UBound(args) = 1 then
select case LCase( args(0) )
case "-input"
' Print out info about file specified
g_strInput = ReadString( args, 0, 1 )
if g_strInput = "" then
ParseParameters = false
exit function
end if
PrintFileInfo()
ParseParameters = false
exit function
end select
end if
' Check all parameters.
for i=0 to UBound(args)
select case LCase( args(i) )
' Parse all input related stuff
case "-wme"
' Get the WME file name to be load.
g_strWMEFile = ReadString( args, i, i+1 )
if g_strWMEFile = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-input"
' Get input source file name.
g_strInput = ReadString( args, i, i+1 )
if g_strInput = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-audioonly"
g_blnAudioOnly = true
case "-videoonly"
g_blnVideoOnly = true
case "-adevice"
g_blnDevice = true
' Get audio device index.
if i+1 <= UBound(args) and Left( args(i+1), 1 ) <> "-" then
g_intAudioDevice = ReadInteger( args, i, i+1 )
if g_intAudioDevice = -1 then
ParseParameters = false
exit function
end if
i = i + 1
else
g_intAudioDevice = 0 ' default audio device
end if
case "-vdevice"
g_blnDevice = true
' Get video device index.
if i+1 <= UBound(args) and Left( args(i+1), 1 ) <> "-" then
g_intVideoDevice = ReadInteger( args, i, i+1 )
if g_intVideoDevice = -1 then
ParseParameters = false
exit function
end if
i = i + 1
else
g_intVideoDevice = 0 ' default video device
end if
' Parse all profile related stuff
case "-profile"
' Get input source file name.
g_strProfile = ReadString( args, i, i+1 )
if g_strProfile = "" then
ParseParameters = false
exit function
end if
i = i + 1
' Parse audio related stuff
case "-a_mode"
g_intAudioVBRMode = ReadInteger( args, i, i+1 )
if g_intAudioVBRMode = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_codec"
'Get audio codec name
g_strAudioCodec = ReadString( args, i, i+1 )
g_strAudioCodec = UCase( g_strAudioCodec )
if g_strAudioCodec <> WMA9STD and g_strAudioCodec <> WMA9PRO and g_strAudioCodec <> WMA9LSL and g_strAudioCodec <> WMSPEECH and g_strAudioCodec <> PCM then
OutputInfo "Please enter correct audio codec index only"
ParseParameters = false
exit function
end if
if g_strAudioCodec = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_setting"
'Get audio setting
g_strAudioSetting = ReadString( args, i, i+1 )
if g_strAudioSetting = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_peakbitrate"
'Get audio peakbitrate size
g_intAudioPeakBitrate = ReadInteger( args, i, i+1 )
if g_intAudioPeakBitrate = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_peakbuffer"
'Get audio peakbuffer size
g_intAudioPeakBuffer = ReadInteger( args, i, i+1 )
if g_intAudioPeakBuffer = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_content"
'Get content type for speech
g_intAudioSpeechContent = ReadInteger( args, i, i+1 )
if g_intAudioSpeechContent = -1 then
ParseParameters = false
exit function
elseif g_intAudioSpeechContent < 0 or g_intAudioSpeechContent > 2 then
OutputInfo "Invalid range for parameter " & args(i)
ParseParameters = false
exit function
end if
i = i + 1
case "-a_contentedl"
'Get EDL file for speech content
g_strAudioSpeechEdl = ReadString( args, i, i+1 )
if g_strAudioSpeechEdl = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-a_folddown6to2"
'Get EDL file for speech content
g_intAudioSurroundMix = ReadInteger( args, i, i+1 )
if g_intAudioSurroundMix = -1 then
ParseParameters = false
exit function
end if
g_intAudioCenterMix = ReadInteger( args, i, i+2 )
if g_intAudioCenterMix = -1 then
ParseParameters = false
exit function
end if
g_intAudioLEFMix = ReadInteger( args, i, i+3 )
if g_intAudioLEFMix = -1 then
ParseParameters = false
exit function
end if
i = i + 3
' Parse video related stuff
case "-v_mode"
g_intVideoVBRMode = ReadInteger( args, i, i+1 )
if g_intVideoVBRMode = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_codec"
'Get video codec name
g_strVideoCodec = ReadString( args, i, i+1 )
g_strVideoCodec = UCase( g_strVideoCodec )
if g_strVideoCodec <> WMV7 and g_strVideoCodec <> WMV8 and g_strVideoCodec <> WMV9 and g_strVideoCodec <> WMS9 and g_strVideoCodec <> MP41 and g_strVideoCodec <> UNCOMP then
OutputInfo "Please enter correct video codec index only"
ParseParameters = false
exit function
end if
if g_strVideoCodec = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_bitrate"
'Get video bitrate
g_intVideoBitrate = ReadInteger( args, i, i+1 )
if g_intVideoBitrate = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_buffer"
'Get video buffer
g_intVideoBuffer = ReadInteger( args, i, i+1 )
if g_intVideoBuffer = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_width"
'Get video width
g_intVideoWidth = ReadInteger( args, i, i+1 )
if g_intVideoWidth = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_height"
'Get video height
g_intVideoHeight = ReadInteger( args, i, i+1 )
if g_intVideoHeight = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_framerate"
'Get video framerate
g_intVideoFramerate = ReadFloat( args, i, i+1 )
if g_intVideoFramerate = -1 then
ParseParameters = false
exit function
end if
g_intVideoFramerate = 1000 * g_intVideoFramerate
i = i + 1
case "-v_keydist"
'Get video keyframe distance
g_intVideoKeydist = ReadInteger( args, i, i+1 )
if g_intVideoKeydist = -1 then
ParseParameters = false
exit function
end if
g_intVideoKeydist = 1000 * g_intVideoKeydist
i = i + 1
case "-v_quality"
'Get video bufferwindow size
g_intVideoQuality = ReadInteger( args, i, i+1 )
if g_intVideoQuality = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_peakbitrate"
'Get video peakbitrate size
g_intVideoPeakBitrate = ReadInteger( args, i, i+1 )
if g_intVideoPeakBitrate = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_peakbuffer"
'Get video peakbuffer size
g_intVideoPeakBuffer = ReadInteger( args, i, i+1 )
if g_intVideoPeakBuffer = -1 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_performance"
'Get video complexity setting
g_intVideoPerformance = ReadInteger( args, i, i+1 )
if g_intVideoPerformance <> 0 and g_intVideoPerformance <> 20 and g_intVideoPerformance <> 40 and g_intVideoPerformance <> 60 and g_intVideoPerformance <> 80 and g_intVideoPerformance <> 100 then
ParseParameters = false
exit function
end if
i = i + 1
case "-v_preproc"
'Get video preprocess setting
g_intVideoPreprocess = ReadInteger( args, i, i+1 )
if g_intVideoPreprocess = -1 or g_intVideoPreprocess > 18 then
OutputInfo "Invalid preproc value: " & args(i+1)
ParseParameters = false
exit function
end if
i = i + 1
case "-pixelformat"
' Get pixelformat.
g_strPixelFormat = ReadString( args, i, i+1 )
if g_strPixelFormat = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-pixelratio"
' Get pixelformat.
g_intPixelAspectRatioX = ReadInteger( args, i, i+1 )
g_intPixelAspectRatioY = ReadInteger( args, i, i+2 )
if g_intPixelAspectRatioX = -1 or g_intPixelAspectRatioY = -1 then
ParseParameters = false
exit function
end if
i = i + 2
case "-v_clip"
' Get clipping values.
g_intClipLeft = ReadInteger( args, i, i+1 )
g_intClipTop = ReadInteger( args, i, i+2 )
g_intClipRight = ReadInteger( args, i, i+3 )
g_intClipBottom = ReadInteger( args, i, i+4 )
if g_intClipLeft = -1 or g_intClipTop = -1 or g_intClipRight = -1 or g_intClipBottom = -1 then
ParseParameters = false
exit function
end if
i = i + 4
case "-v_profile"
' Get video device conformance value
g_strVideoDevConf = ReadString( args, i, i+1 )
g_strVideoDevConf = UCase( g_strVideoDevConf )
if g_strVideoDevConf = "" then
ParseParameters = false
exit function
end if
i = i + 1
' Parse all output related stuff
case "-output"
' Get output file name.
g_strOutput = ReadString( args, i, i+1 )
if g_strOutput = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-outputstring"
' Read in the string that is to be appended to output file name
g_strOutputString = ReadString( args, i, i+1 )
if g_strOutputString = "" then
ParseParameters = false
exit function
end if
i = i + 1
case "-broadcast"
' Get broadcast port number.
if i+1 <= UBound(args) and Left( args(i+1), 1 ) <> "-" then
g_intBroadcast = ReadInteger( args, i, i+1 )
if g_intBroadcast = -1 then
ParseParameters = false
exit function
end if
i = i + 1
else
g_intBroadcast = 8080
end if
case "-push"
' Get push server, pub point and template name (optional)
g_strPushServer = ReadString( args, i, i+1 )
g_strPublishingPoint = ReadString( args, i, i+2 )
if g_strPushServer = "" or g_strPublishingPoint = "" then
ParseParameters = false
exit function
end if
' Check if template name is specified
if i+1 <= UBound(args) and Left( args(i+3), 1 ) <> "-" then